package com.qk.mapper;

import com.qk.entity.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RoleMapper {
    @Insert("INSERT INTO role(name, label, remark, create_time, update_time) VALUES(#{name}, #{label}, #{remark}, #{createTime}, #{updateTime})")
    void insert(Role role);

    void updateRole(Role role);


    @Delete("DELETE FROM role WHERE id = #{id}")
    void deleteRole(Integer id);


    @Select("SELECT id, name, label, remark, create_time, update_time FROM role WHERE id = #{id}")
    Role getRoleById(Integer id);


    @Select("SELECT id, name, label, remark, create_time, update_time FROM role ORDER BY update_time DESC")
    List<Role> getAllRoles();


    List<Role> getRoles(String name, String label);
}

